$(document).ready(function() {
	//coloring leksems table
	//$('#leks-table tr:even').addClass("colored");
	
	$('#lang').change(function(){
		var leksId = $('#hid-leks-id').val();
		var dictId = $(this).val();
		if(dictId == 0) {
			$('#translation').html('<p>Please choose a language</p>');
			return
		}
		$.ajax({
   			type: "post",
   			url: "index.php?cont=ajax&act=getTranslation",
   			data: "lid="+leksId+"&did="+dictId,
   			success: function(data){
                if(data == '') {
                    data = '<p style="color: red;">Translation does not exsist</p>';
                }
     			$('#translation').html('<p>' + data + '</p>');
   			}
 		});
	})
	
	$('#website-id').change(function(){
		var wsId = $('#website-id').val(); 
		$.ajax({
   			type: "post",
   			url: "index.php?cont=ajax&act=setCurrWebsite",
   			data: "id="+wsId,
   			success: function(data){
     			$('#wsname').html(data);
     			window.location = "index.php?cont=leks";
   			}
 		});
	})

    $("#leks-table").tablesorter({
        widgets: ["zebra"],
        sortList:[[0,0]]
    });

	$('#settings-screen').click(function(){
		$('#profile-data').hide();
		$('#ps').show();
	});

	$('#profile-screen').click(function(){
		$('#profile-data').show();
		$('#ps').hide();
	});

	confirmDeletionLeks = function(id) {
		var conf = confirm("Are you sure you want to delete this leksem? This operation can not be undone!");
		if(conf) {
			window.location = 'index.php?cont=leks&act=delete&id=' + id;
		}
		else {
			return;
		}
	}

});
